//=============================================================================
//
//   File : gui_launcher.h
//   Creation date : Sab 19 mar 2011 09:31:42 CET by Antonino G.Imbesi
//
//   This file is part of the QtGLauncher distribution
//   Copyright (C) 2011 Antonino G. Imbesi <grifisx at barmes dot org>
//                      Antonio Saporita: Mac OS X code implementation
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#ifndef GUI_LAUCHER_H
#define GUI_LAUCHER_H

/*
Q_WS_X11 for X11
Q_WS_WIN for Windows
Q_WS_MACX for MacOS X
Q_WS_QWS for Embedded

  */

#include <QWidget>
#include <QSystemTrayIcon>

class qtg_listviewitem;
class qtg_QTreeWidgetItem;
class qtg_treewidget;
class qtg_qpushbutton;
class qtg_lineedit;
class qtg_xml_reader;
class qtg_QTreeWidget;
class qtg_appinstaller;
class qtg_config;

class QTreeWidgetItem;
class QCloseEvent;
class QProcess;
class QAction;
class QMenu;
class QSettings;
class QStringList;
class QString;
class QMouseEvent;
class QPoint;

class gui_laucher : public QWidget
{
    Q_OBJECT

public:
    gui_laucher(QWidget *parent = 0);
    ~gui_laucher();
    qtg_QTreeWidgetItem *m_pItemRecents;
    void setupTray();

    QSettings *m_appConf;
    QSettings *m_btnConf;
    QSettings *m_recentsConf;

public slots:
    void open();
    void startProcess(QTreeWidgetItem *, int);
    void slotToggleVisibility();
    void closeEvent(QCloseEvent *);
    void slotTrayActivated(QSystemTrayIcon::ActivationReason);
    void createActions();
    void setmyStyleSheet();
    void openFolderPath(QString path = "./");
    void loadConfig();
    void showOptionDialog();

    QStringList getfsInfo();
    QStringList toHuman(float);

    void filterTree(const QString&);
    void makeRecents();

protected:
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
 //   void enterEvent(QEvent *event);
 //   void leaveEvent(QEvent *event);
private:
    qtg_QTreeWidget *m_pTreeWidget;
    qtg_config *m_pConfigDialog;
    QPoint dragPosition;
    QProcess *m_pProcess;
    QSystemTrayIcon *m_pTray;

    QAction *m_pMinimizeAction;
    QAction *m_pMaximizeAction;
    QAction *m_pRestoreAction;
    QAction *m_pQuitAction;

    QWidget *m_pButtonsWidget;
    QWidget *m_pTopWidget;
    QMenu *m_pTrayIconMenu;
};

#endif // GUI_LAUCHER_H
